package com.atguigu.gulimall.order.controller;

import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.UUID;

@Controller
@ResponseBody
public class TestRabbitMqController {
    @Autowired
    private RabbitTemplate rabbitTemplate;
    @GetMapping("/sendMsg")
    public String senMsg(){

        rabbitTemplate.convertAndSend("direct.exchange1","blue","hello",new CorrelationData(UUID.randomUUID().toString()));

        return "ok";
    }
}
